<template>
  <div class="rank">
    
    <div class="content">
      <ul>
        <li>
          <div class="img-item" v-for="(goods,index) in goodsList" :key="index">
            <p class="tab-pic">
              <router-link :to="`/detail/${goods.productId}`">
                <img :src="goods.imageUrl" />
              </router-link>
            </p>
            <div class="tab-info">
              <div class="info-title">
                <h3>{{ goods.name }}</h3>
                {{ goods.description}}
               
              </div>
              <p class="info-price">定金：¥{{goods.price}}</p>
            </div>
          </div>
          <!-- <div class="img-item">
            <p class="tab-pic">
              <a href="#">
                <img src="./images/1.jpg" />
              </a>
            </p>
            <div class="tab-info">
              <div class="info-title">
                <a href="#"
                  >【官网价直降1100】Apple iPhone 8 Plus 256GB 银色
                  移动联通电信4G手机</a
                >
              </div>
              <p class="info-price">定金：¥100.00</p>
            </div>
          </div>
          <div class="img-item">
            <p class="tab-pic">
              <a href="#">
                <img src="./images/1.jpg" />
              </a>
            </p>
            <div class="tab-info">
              <div class="info-title">
                <a href="#"
                  >【官网价直降1100】Apple iPhone 8 Plus 256GB 银色
                  移动联通电信4G手机</a
                >
              </div>
              <p class="info-price">定金：¥100.00</p>
            </div>
          </div>
          <div class="img-item">
            <p class="tab-pic">
              <a href="#">
                <img src="./images/1.jpg" />
              </a>
            </p>
            <div class="tab-info">
              <div class="info-title">
                <a href="#"
                  >【官网价直降1100】Apple iPhone 8 Plus 256GB 银色
                  移动联通电信4G手机</a
                >
              </div>
              <p class="info-price">定金：¥100.00</p>
            </div>
          </div> -->
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import myhomeapi from "@/api/myhome";
import { mapGetters } from "vuex";
export default {
    name:'Rank',
    data() {
    return {
      searchParams: {
        categoryId: "", //一级分类的id
        categoryName: "", //商品的名字
        keyword: "", //用户搜索的关键字
        props: [], //商品属性的搜索条件
        trademark: "", //品牌的搜索条件
        order: "1:desc", //排序的参数 【默认初始值:1:desc】
        pageNo: 1, //当前分页器的页码  【默认初始值:1】
        pageSize: 5, //代表当前一页显示几条数据 【默认初始值:10】
      },
      goodsList:[]
    }
  
    },
created(){
  this.getData()
},
methods:{
  getData() {
      // this.$store.dispatch("SearchList", this.searchParams);
      myhomeapi.reqGoodsInfos().then(res=>{
        console.log("this.goodsList=res.data")
          this.goodsList=res.data
          console.log(res.data)

      })
    },
},
computed: {
    ...mapGetters(["goodsList","total"]),
}

};
</script>

<style lang="less" scoped>
.rank {
  width: 1200px;
  margin: 0 auto;

  

  .content {
    overflow: hidden;
    padding: 10px;

    ul {
      li {
        overflow: hidden;
        list-style: none;
        line-height: 18px;

        .img-item {
          border: 1px solid #e1251b;
          width: 269px;
          float: left;
          overflow: hidden;
          margin: 0 11px 10px;
          background: #fff;

          .tab-pic {
            width: 230px;
            height: 210px;
            overflow: hidden;
            text-align: center;
            margin: 5px auto 18px;

            a {
              img {
                width: 200px;
                height: 200px;
              }
            }
          }

          .tab-info {
            background: #fafafa;

            .info-title {
              height: 50px;
              line-height: 28px;
              overflow: hidden;
              margin: 0 auto;
              padding-left: 10px;

              a {
                color: #333;
                text-decoration: none;
              }
            }

            .info-price {
              font-size: 20px;
              color: #e1251b;
              height: 35px;
              padding-left: 10px;
              display: block;
              line-height: 24px;
              margin: 10px auto 0;
            }
          }
        }
      }
    }
  }
}
</style>